package com.wyg.epdata.config;

import com.wyg.epdata.common.constant.BaseConstant;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component//地址映射
public class WebMvcConfig implements WebMvcConfigurer {

    //静态资源
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/file/**").addResourceLocations("file:" + BaseConstant.fileLoadPath + "/");
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }


//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new LoginFilter()).addPathPatterns("/user");
//        WebMvcConfigurer.super.addInterceptors(registry);
//    }
//


//    @Override
//    public void addCorsMappings(CorsRegistry registry) {
//        //添加映射路径
//        registry.addMapping("/**")
//                //是否发送Cookie
////                .allowCredentials(true);
////                //设置放行哪些原始域   SpringBoot2.4.4下低版本使用.allowedOrigins("*")
////                .allowedOrigins("http://localhost");
////                .allowedMethods("*") //或者放行全部
//                //放行哪些原始请求头部信息
////                .allowedHeaders("*")
//                //暴露哪些原始请求头部信息
////                .exposedHeaders("*");
//    }

}
